package com.example.server.vo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

@Data
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
public class RespBean {

    private Integer code;

    private String msg;

    private Object data;

    public static RespBean success(Object data){

        return success(200, "请求成功", data);
    }

    public static RespBean success(Integer code, String msg, Object data) {

        return new RespBean(code, msg, data);
    }

    public static RespBean success(Integer code, String msg) {

        return success(code, msg, null);
    }

    public static RespBean success(){

        return success(0, "请求成功", null);
    }

    public static RespBean error(Integer code, String msg) {

        return new RespBean(code, msg, null);
    }
}
